from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class User(AbstractUser):
    class Meta:
        db_table='tb_users'
        verbose_name='用户'
        verbose_name_plural=verbose_name
class UserInfo(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile',unique=True)
    sid = models.CharField(max_length=20, null=True, verbose_name='学号')
    name = models.CharField(verbose_name='姓名', max_length=10, null=True)
    age = models.IntegerField(verbose_name='年龄', null=True)
    gender = models.CharField(max_length=1, choices=[(0, '男'), (1, '女')], null=True, verbose_name='性别')
    wx = models.CharField(max_length=30, verbose_name='微信', null=True)
    phone = models.CharField(max_length=20, null=True, verbose_name='电话')
    school = models.CharField(max_length=20, null=True, verbose_name='学校')
    faculty = models.CharField(max_length=20, null=True, verbose_name='院系')
    major = models.CharField(max_length=20, null=True, verbose_name='专业')
    result=models.TextField(max_length=1000)
    grade = models.CharField(max_length=10, null=True, verbose_name='年级')
    class Meta:
        db_table='tb_userinfo'

# 在现有模型下方添加
class UserSurveyInfo(models.Model):
    """用户完善信息模型类"""
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='survey_info')
    place = models.CharField(max_length=50, verbose_name='生源地', null=True, blank=True)
    age_group = models.CharField(max_length=20, verbose_name='年龄段', null=True, blank=True)
    want_city = models.CharField(max_length=100, verbose_name='期望城市', null=True, blank=True)
    want_job = models.CharField(max_length=100, verbose_name='期望职业', null=True, blank=True)
    work_experience = models.IntegerField(default=0, verbose_name='实习次数')
    real_name = models.CharField(max_length=50, verbose_name='姓名', null=True, blank=True)
    phone = models.CharField(max_length=20, verbose_name='联系电话', null=True, blank=True)
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_user_survey_info'
        verbose_name = '用户完善信息'
        verbose_name_plural = verbose_name
